package com.bank.mygold;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new PlaceholderFragment())
                    .commit();
        }
	
        
    }
    
    @Override
    protected void onResume(){
    	
    	Intent data = getIntent();
    	String result = data.getStringExtra("result");
    	String msg_full = data.getStringExtra("message");
    	
    	myToast("result: " + result + "\n msg: " + msg_full);	
    	super.onResume();
    }
    
    @Override
    protected void onNewIntent(Intent intent){
    	
    	super.onNewIntent(intent);
    	setIntent(intent);
    }
    

    
    void myToast (String text){
    	if (text != null )
    		Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
    }


    public static class PlaceholderFragment extends Fragment {

        public PlaceholderFragment() {}

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container, false);
            return rootView;
        }
    }
    
}//class



